﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

using System.Data.SQLite;

namespace DbHelper.Driver
{
    public class SQLLiteDriver : IDriver
    {
        SQLiteConnection connection;
        SQLiteCommand command;
        SQLiteDataAdapter dataAdapter;
        SQLiteCommandBuilder commandBuilder;


        public void Connect(string connectionString)
        {
            connection = new SQLiteConnection(connectionString);
            command = connection.CreateCommand();
            dataAdapter = new SQLiteDataAdapter(command);
            commandBuilder = new SQLiteCommandBuilder(dataAdapter);
        }

        public IDriver CreateInstance()
        {
            return new SQLLiteDriver();
        }

        public IDbConnection DbConnection
        {
            get { return connection; }
        }

        public IDbCommand DbCommand
        {
            get { return command; }
        }

        public IDbDataAdapter DbDataAdapter
        {
            get { return dataAdapter; }
        }
    }
}
